package com.haruhi.bot.job;

import com.haruhi.bot.job.thread.DeleteRepeatPictureThread;
import com.haruhi.bot.job.thread.PutPicFromHaruhiThread;
import com.haruhi.bot.service.PixPictureService;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

/**
 * 定期处理重复图片
 */
public class DeleteRepeatPictureJob {

    private static ScheduledExecutorService pool = Executors.newScheduledThreadPool(1);
    // 24小时执行一次
    private static long period = 1000 * 60 * 60 * 24;
    // 延迟60分钟
    private static long initialDelay = 1000 * 60 * 60;

    public static void start(PixPictureService service){
        pool.scheduleAtFixedRate(new DeleteRepeatPictureThread(service),initialDelay,period, TimeUnit.MILLISECONDS);
    }
}
